<html>
<head><meta charset="utf-8"><title>Reversed type diagnostics? · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Reversed.20type.20diagnostics.3F.html">Reversed type diagnostics?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="177478889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Reversed%20type%20diagnostics%3F/near/177478889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Reversed.20type.20diagnostics.3F.html#177478889">(Oct 06 2019 at 22:17)</a>:</h4>
<p>I have been finding myself super confused by some error messages related to async blocks and functions: mostly because their errors are reported in exactly the opposite location than I would expect…</p>



<a name="177478890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Reversed%20type%20diagnostics%3F/near/177478890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Reversed.20type.20diagnostics.3F.html#177478890">(Oct 06 2019 at 22:17)</a>:</h4>
<p>/me finds an example…</p>



<a name="177478935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Reversed%20type%20diagnostics%3F/near/177478935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Reversed.20type.20diagnostics.3F.html#177478935">(Oct 06 2019 at 22:18)</a>:</h4>
<p><a href="https://paste.rs/rXR" target="_blank" title="https://paste.rs/rXR">https://paste.rs/rXR</a> is the error and <a href="https://paste.rs/1vC.rs" target="_blank" title="https://paste.rs/1vC.rs">https://paste.rs/1vC.rs</a> is the code. The wrong part with it is the fact that <code>Ok(make_service)</code> needs to be <code>Ok::&lt;_, ErrT&gt;(make_service)</code>, but you get the report elsewhere entirely, unlike with what you’d get for plain old regular code.</p>



<a name="177478939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Reversed%20type%20diagnostics%3F/near/177478939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Reversed.20type.20diagnostics.3F.html#177478939">(Oct 06 2019 at 22:18)</a>:</h4>
<p>But als I’ve found that plain type mismatch errors have reversed expected and found types, but I do not have an example offhand</p>



<a name="177516240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Reversed%20type%20diagnostics%3F/near/177516240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Reversed.20type.20diagnostics.3F.html#177516240">(Oct 07 2019 at 12:59)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> thanks for the report! can you file an issue?</p>



<a name="177516266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Reversed%20type%20diagnostics%3F/near/177516266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Reversed.20type.20diagnostics.3F.html#177516266">(Oct 07 2019 at 12:59)</a>:</h4>
<p>I agree the span is not great</p>



<a name="177516282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Reversed%20type%20diagnostics%3F/near/177516282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Reversed.20type.20diagnostics.3F.html#177516282">(Oct 07 2019 at 12:59)</a>:</h4>
<p>not sure off hand what it would take to fix it, but it'd be good to have a representative issue to track it</p>



<a name="177635275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Reversed%20type%20diagnostics%3F/near/177635275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Reversed.20type.20diagnostics.3F.html#177635275">(Oct 08 2019 at 16:53)</a>:</h4>
<p>(  <a href="https://github.com/rust-lang/rust/issues/65180" target="_blank" title="https://github.com/rust-lang/rust/issues/65180">#65180</a> was the filed issue)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>